class Solution2 {
    public int minArray(int[] numbers) {
        int left = 0, right = numbers.length - 1;
        while (left < right) {
            int mid = (left + right) >> 1;
            if (numbers[mid] > numbers[right]) left = mid + 1;
            else if (numbers[mid] < numbers[right]) right = mid;
            else right--;
        }
        return numbers[left];
    }

    public static void main(String[] args) {
        Solution s = new Solution();
        System.out.println(s.minArray(new int[]{2, 2, 2, 0}));
    }
}